import { computed, reactive } from 'vue';
import { useCurrent } from './router';

const _state = {};
const _actions = {};
export function useStore() {
  const routeKey = useCurrent()?.route;
  if (!routeKey) {
    throw new Error('为获取到页面');
  }
  if (!_state[routeKey]) {
    _state[routeKey] = reactive({});
    _actions[routeKey] = {};
  }
  return _state[routeKey];
}
